/*
 * PlainDocumentDelegate.h  0.4.0 / Dec 04, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef PLAINDOCUMENTDELEGATE_H
#define PLAINDOCUMENTDELEGATE_H

#include "Cute4jSwing.h"

#include "PlainDocument.h"
#include "TextDocumentDelegate.h"

// PlainDocumentDelegate Class. ------------------------------------------------

/*!
 * \brief Plain Document Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT PlainDocumentDelegate : public TextDocumentDelegate
{
  Q_OBJECT
protected:
  PlainDocumentDelegate(JNIEnv *env, jobject obj);
public: // native calls
  static jlong newInstance(JNIEnv *env, jobject obj);
public:
  inline PlainDocument *plainDocument() const;
};

// PlainDocumentDelegate :: Inline Member Function. ----------------------------

/*!
 * \brief Returns PlainDocument adaptee.
 *
 * \return PlainDocument adaptee
 */
inline PlainDocument *PlainDocumentDelegate::plainDocument() const
{
  return static_cast<PlainDocument *>(qObject());
}

// Macro Definition. -----------------------------------------------------------

#define PLAIN_DOCUMENT_DELEGATE \
    (reinterpret_cast<PlainDocumentDelegate *>(delegate))

#endif // PLAINDOCUMENTDELEGATE_H
